package com.alex.core.contants.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 设备类型枚举
 * @author cb
 * @date 2019/10/17 10:37
 */
@AllArgsConstructor
@Getter
public enum DeviceTypeEnum {

    //    设备类型(1充电桩 2充电柜 3直流汽车充电桩 7交流汽车充电桩 4电吹风 5洗衣机 6手机充电站 8热水器控制器)

    CHARGING_PILE(1, "充电桩", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    CHARGING_CABINET(2, "充电柜", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    DC_CAR_CHARGING_PILE(3, "直流汽车充电桩", CarChargerEnum.CAR, CarPileTypeEnum.DC),
    AC_CAR_CHARGING_PILE(7, "交流汽车充电桩", CarChargerEnum.CAR, CarPileTypeEnum.AC),
    HAIR_DRIER(4, "电吹风", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    WASHING_MACHINE(5, "洗衣机", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    MOBILE_CHARGING_STATION(6, "手机充电站", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    WATER_HEATER_CONTROLLER(8, "热水器控制器", CarChargerEnum.NOT_CAR, CarPileTypeEnum.UN_KHOWN),
    ;
    private Integer code;
    private String value;
    private CarChargerEnum carChargerEnum;
    private CarPileTypeEnum carPileTypeEnum;

    public static DeviceTypeEnum getByCode(Integer code) {
        for (DeviceTypeEnum deviceTypeEnum:values()) {
            if (deviceTypeEnum.getCode().equals(code)) {
                return deviceTypeEnum;
            }
        }
        return null;
    }
}
